package com.qfedu.tantu.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qfedu.tantu.dto.CollectDto;
import com.qfedu.tantu.entity.Collect;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 收藏dao
 * */
public interface CollectDao extends BaseMapper<Collect> {
    @Insert("insert into t_collect (uid,aid) value (#{uid},#{aid})")
    int insertPass(@Param("uid") int uid, @Param("aid") int aid);

    @Select("select a.* from t_collect t,t_article a where t.uid=#{uid} and t.aid=a.id")
    List<CollectDto> selectPass(@Param("uid") int uid);

    @Select("select * from t_article where id=#{id}")
    CollectDto selectCollect(@Param("id") int id);

}
